The present invention relates to a curvilinear interpolation system and method for a numerical control apparatus such as a machine tool or a robot having two or more drive axes and movable while effecting linear interpolation on a given curve with a plurality of line segments.
It is difficult to numerically control a machine tool or robot so as to move without error along a curve defined in a two- or three-dimensional space. Therefore, it has been the customary practice to approximate the curve with a number of short line segments within a given allowable error for curvilinear interpolation control. FIG. 1 of the accompanying drawings is illustrative of such curvilinear interpolation control. A given curve Li is approximated by line segments P.sub.0 P.sub.1, P.sub.1 P.sub.2, P.sub.2 P.sub.3, P.sub.3 P.sub.4, P.sub.4 P.sub.5. It is here assumed that maximum errors between the line segments and the ideal curve Li are t.sub.1, t.sub.2, t.sub.3, t.sub.4, t.sub.5, respectively, and an allowable error (tolerance) is .tau.. It is desirable for curvilinear interpolation that all of these maximum errors t.sub.1, t.sub.2, t.sub.3, t.sub.4, t.sub.5 be smaller than the tolerance.
Two methods which have conventionally been employed for the curvilinear interpolation will be described.
FIG. 2 illustrates the first method. On the ideal curve Li, from a starting point P.sub.0, a group of points P.sub.1 to P.sub.6 are spaced at constant intervals. First, a maximum error t.sub.1 between a line segment P.sub.0 P.sub.1 and the curve Li is compared with a tolerance .tau.. Since t.sub.1 .ltoreq..tau., the point P.sub.1 is skipped. Then, the points P.sub.1 to P.sub.6 are successively checked, and it is assumed that t.sub.6 &gt;.tau. is achieved for the first time for the line segment P.sub.0 P.sub.6. An interpolation point next to the point P.sub.0 is then determined as the point P.sub.5, which is one point prior to the point P.sub.6. Then, the point P.sub.5 is set as a new starting point. In this manner, successive interpolated line segments are determined. This method is capable of effecting polygonally approximated interpolation in which the tolerance .tau. is ensured. However, it is disadvantageous in that the time required for calculation is long since a number of points must be successively checked, and it is not easy for the operator to determine how close the points should be established.
According to the second method, interpolating points are determined using the curvature of a given curve as shown in FIGS. 3 through 6. FIG. 3 is illustrative of the relationship between the radius of curvature .tau. of a curve Li having the form of an arc, the length d of an approximating line segment, and points where the curve Li is divided by the approximating line. It is assumed that the point C is the center of curvature of the arc, the line segment P.sub.1 P.sub.2 is the approximating line segment, and the points of intersection between a bisector of the angle .angle.P.sub.1 CP.sub.2 and the curve Li and between this bisector and the line segment P.sub.1 P.sub.2 are P.sub.A and P.sub.B, respectively. At this time, EQU (P.sub.1 P.sub.2 /2).sup.2 +(P.sub.B C).sup.2 =(P.sub.1 C).sup.2
Since P.sub.1 P.sub.2 =d, P.sub.B C=.rho.-t, P.sub.1 C=.rho., EQU t.sup.2 -2.rho.t+d.sup.2 /4=0 (1)
and ##EQU1## Equation (2) gives a maximum line segment length .DELTA.S at the time of approximating the arc having the radius .rho. of curvature with a line segment when the tolerance .tau. is given. That is, ##EQU2## The tolerance is ensured if the line segment has a length of .DELTA.S or smaller.
In general, in the second method a given curve is considered as being composed of a succession of arcs including an arc having an infinite radius of curvature, and such a curve is subjected to linear interpolation. For the sake of simplicity, the second method will be described with reference to curves composed only of a straight line and curves on a two-dimensional plane.
FIG. 4 is explanatory of interpolation of a curve Li made up of an arc having a center of curvature C1 and a radius of curvature .rho..sub.1 and an arc having a center of curvature C2 and a radius of curvature .rho..sub.2, the arcs blending smoothly with each other at a point P.sub.5. From equation (3), the length .DELTA.S.sub.1 of a line segment for the arc having the radius of curvature .rho..sub.1 is .DELTA.S.sub.1 =2.sqroot.2.rho..sub.1 .tau.-.tau..sup.2, and the length .DELTA.S.sub.2 of a line segment for the arc having the radius of curvature .rho..sub.2 is .DELTA.S.sub.2 =2.sqroot.2.rho..sub.2 .tau.-.tau..sup.2 .multidot.P.sub.1 P.sub.2, P.sub.2 P.sub.3, P.sub.3 P.sub.4 and P.sub.4 P.sub.5 are approximated by the line segment having the length .DELTA.S.sub.1, and P.sub.5 P.sub.6, P.sub.6 P.sub.7 and P.sub.7 P.sub.8 are approximated by the line segment having the length .DELTA.S.sub.2, thus achieving linear interpolation in which the tolerance is ensured.
This method, however, has the following shortcoming: In FIG. 5, an arc having a radius of curvature .rho..sub.1 and an arc having a radius of curvature .rho..sub.2 are joined at a point P.sub.C. Interpolating points are determined from a starting point P.sub.0 by line segments P.sub.0 P.sub.1, P.sub.1 P.sub.2, P.sub.2 P.sub.3, P.sub.3 P.sub.4 and P.sub.4 P.sub.5 having the length S.sub.1 =2.sqroot.2.rho..sub.1 .tau.-.tau..sup.2. The length of a line segment at a point P.sub.5 is also .DELTA.S.sub.1 since P.sub.5 P.sub.C is an arc having the radius of curvature .rho..sub.1. If a next point P.sub.6 is determined as being on an arc having the radius of curvature .rho..sub.2, then a curve portion P.sub.5 P.sub.C P.sub.6 is approximated by a line segment P.sub.5 P.sub.6 for which no tolerance .tau. is ensured.
FIG. 6 is illustrative of interpolation of a curve Li composed of a straight line joined smoothly at a point P.sub.C with an arc having a center of curvature C and a radius of curvature .rho.. The length of a line segment which approximates the straight line is infinite from the equation (3). Therefore, a maximum line segment length l.sub.L is established, and the operator is allowed to select such a maximum line segment length. However, it is troublesome for the operator to ascertain the setting of the maximum line segment length l.sub.L and hence inconvenient to handle the same. Where the straight line is approximated with line segments P.sub.1 P.sub.2, P.sub.2 P.sub.3 and P.sub.3 P.sub.4 having the length l.sub.L, a next point P.sub.4 is determined with the length l.sub.L since the point P.sub.4 is on the straight line, with the result that no tolerance .tau. is ensured. This is because the arc has to be approximated with line segments having a length of l.sub.S or smaller calculated by l.sub.S =2.sqroot.2.rho..tau.-.tau..sup.2 with l.sub.L &gt;l.sub.S.
As discussed above, the second method has a shorter time for calculation than the first method and lends itself to high-speed processing, but is incapable of performing accurate curvilinear interpolation unless the above deficiencies are eliminated.